﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class Index : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ProFilmPoster pfp = new ProFilmPoster();
        DataSet ds = new DataSet();
        ds = pfp.LoadPoster(7);
        this.lblNsgPeriodShow.Text = String.Format("{0:dd/MM/yyyy}", DateTime.Parse(ConfigurationManager.AppSettings.GetValues("startshow")[0])) + " - " +
                                    String.Format("{0:dd/MM/yyyy}", DateTime.Parse(ConfigurationManager.AppSettings.GetValues("endshow")[0]));
        this.lblDmPeriodShow.Text = this.lblNsgPeriodShow.Text;
        SetFilmPosterNsg(ds);

        ds = new DataSet();
        ds = pfp.LoadPoster(1);
        SetFilmPosterDm(ds);
    }
    private void SetFilmPosterNsg(DataSet ds)
    {
        SetFilmPosterNSG1(ds);
        SetFilmPosterNSG2(ds);
        SetFilmPosterNSG3(ds);
        SetFilmPosterNSG4(ds);
        SetFilmPosterNSG5(ds);
        SetFilmPosterNSG6(ds);
        SetFilmPosterNSG7(ds);
        SetFilmPosterNSG8(ds);
    }
    private void SetFilmPosterDm(DataSet ds)
    {
        SetFilmPosterDm1(ds);
        SetFilmPosterDm2(ds);
        SetFilmPosterDm3(ds);
        SetFilmPosterDm4(ds);
        SetFilmPosterDm5(ds);
        SetFilmPosterDm6(ds);
    }
    #region Set Film Poster Diamond
    private void SetFilmPosterDm1(DataSet ds)
    {
        if (ds.Tables[0].Rows.Count <= 0)
        {
            this.dmPoster1.Visible = false;
            this.dmName1.Visible = false;
            return;
        }
        this.dmFilmLink1.ImageUrl = ds.Tables[0].Rows[0]["Image"].ToString();
        this.dmFilmTitle1.InnerText = ds.Tables[0].Rows[0]["NameVN"].ToString();
    }
    private void SetFilmPosterDm2(DataSet ds)
    {
        if (ds.Tables[0].Rows.Count <= 1)
        {
            this.dmPoster2.Visible = false;
            this.dmName2.Visible = false;
            return;
        }
        this.dmFilmLink2.ImageUrl = ds.Tables[0].Rows[1]["Image"].ToString();
        this.dmFilmTitle2.InnerText = ds.Tables[0].Rows[1]["NameVN"].ToString();
    }
    private void SetFilmPosterDm3(DataSet ds)
    {
        if (ds.Tables[0].Rows.Count <= 2)
        {
            this.dmPoster3.Visible = false;
            this.dmName3.Visible = false;
            return;
        }
        this.dmFilmLink3.ImageUrl = ds.Tables[0].Rows[2]["Image"].ToString();
        this.dmFilmTitle3.InnerText = ds.Tables[0].Rows[2]["NameVN"].ToString();
    }
    private void SetFilmPosterDm4(DataSet ds)
    {
        if (ds.Tables[0].Rows.Count <= 3)
        {
            this.dmPoster4.Visible = false;
            this.dmName4.Visible = false;
            return;
        }
        this.dmFilmLink4.ImageUrl = ds.Tables[0].Rows[3]["Image"].ToString();
        this.dmFilmTitle4.InnerText = ds.Tables[0].Rows[3]["NameVN"].ToString();
    }
    private void SetFilmPosterDm5(DataSet ds)
    {
        if (ds.Tables[0].Rows.Count <= 4)
        {
            this.dmPoster5.Visible = false;
            this.dmName5.Visible = false;
            return;
        }
        this.dmFilmLink5.ImageUrl = ds.Tables[0].Rows[4]["Image"].ToString();
        this.dmFilmTitle5.InnerText = ds.Tables[0].Rows[4]["NameVN"].ToString();
    }
    private void SetFilmPosterDm6(DataSet ds)
    {
        if (ds.Tables[0].Rows.Count <= 5)
        {
            this.dmPoster6.Visible = false;
            this.dmName6.Visible = false;
            return;
        }
        this.dmFilmLink6.ImageUrl = ds.Tables[0].Rows[5]["Image"].ToString();
        this.dmFilmTitle6.InnerText = ds.Tables[0].Rows[5]["NameVN"].ToString();
    }
    #endregion

    #region Set Film Poster Nam Sai Gon
    private void SetFilmPosterNSG1(DataSet ds)
    {
        if (ds.Tables[0].Rows.Count <= 0)
        {
            this.nsgPoster1.Visible = false;
            this.nsgName1.Visible = false;
            return;
        }
        this.nsgFilmLink1.ImageUrl = ds.Tables[0].Rows[0]["Image"].ToString();
        this.nsgFilmTitle1.InnerText = ds.Tables[0].Rows[0]["NameVN"].ToString();
    }
    private void SetFilmPosterNSG2(DataSet ds)
    {
        if (ds.Tables[0].Rows.Count < 1)
        {
            this.nsgPoster2.Visible = false;
            this.nsgName2.Visible = false;
            return;
        }
        this.nsgFilmLink2.ImageUrl = ds.Tables[0].Rows[1]["Image"].ToString();
        this.nsgFilmTitle2.InnerText = ds.Tables[0].Rows[1]["NameVN"].ToString();
    }
    private void SetFilmPosterNSG3(DataSet ds)
    {
        if (ds.Tables[0].Rows.Count <= 2)
        {
            this.nsgPoster3.Visible = false;
            this.nsgName3.Visible = false;
            return;
        }
        this.nsgFilmLink3.ImageUrl = ds.Tables[0].Rows[2]["Image"].ToString();
        this.nsgFilmTitle3.InnerText = ds.Tables[0].Rows[2]["NameVN"].ToString();
    }
    private void SetFilmPosterNSG4(DataSet ds)
    {
        if (ds.Tables[0].Rows.Count <= 3)
        {
            this.nsgPoster4.Visible = false;
            this.nsgName4.Visible = false;
            return;
        }
        this.nsgFilmLink4.ImageUrl = ds.Tables[0].Rows[3]["Image"].ToString();
        this.nsgFilmTitle4.InnerText = ds.Tables[0].Rows[3]["NameVN"].ToString();
    }
    private void SetFilmPosterNSG5(DataSet ds)
    {
        if (ds.Tables[0].Rows.Count <= 4)
        {
            this.nsgPoster5.Visible = false;
            this.nsgName5.Visible = false;
            return;
        }
        this.nsgFilmLink5.ImageUrl = ds.Tables[0].Rows[4]["Image"].ToString();
        this.nsgFilmTitle5.InnerText = ds.Tables[0].Rows[4]["NameVN"].ToString();
    }
    private void SetFilmPosterNSG6(DataSet ds)
    {
        if (ds.Tables[0].Rows.Count <= 5)
        {
            this.nsgPoster6.Visible = false;
            this.nsgName6.Visible = false;
            return;
        }
        this.nsgFilmLink6.ImageUrl = ds.Tables[0].Rows[5]["Image"].ToString();
        this.nsgFilmTitle6.InnerText = ds.Tables[0].Rows[5]["NameVN"].ToString();
    }
    private void SetFilmPosterNSG7(DataSet ds)
    {
        if (ds.Tables[0].Rows.Count <= 6)
        {
            this.nsgPoster7.Visible = false;
            this.nsgName7.Visible = false;
            return;
        }
        this.nsgFilmLink7.ImageUrl = ds.Tables[0].Rows[6]["Image"].ToString();
        this.nsgFilmTitle7.InnerText = ds.Tables[0].Rows[6]["NameVN"].ToString();
    }
    private void SetFilmPosterNSG8(DataSet ds)
    {
        if (ds.Tables[0].Rows.Count <= 7)
        {
            this.nsgPoster1.Visible = false;
            this.nsgName1.Visible = false;
            return;
        }
        this.nsgFilmLink8.ImageUrl = ds.Tables[0].Rows[7]["Image"].ToString();
        this.nsgFilmTitle8.InnerText = ds.Tables[0].Rows[7]["NameVN"].ToString();
    }
    #endregion

    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        //map nam sai gon
        Response.Redirect("Map.aspx");
    }
    protected void lichvn_namsg_Click(object sender, EventArgs e)
    {
        //lich chieu tieng viet Rap Nam SG
        Response.Redirect("lich_namsg.aspx");
    }
    protected void giavn_namsg_Click(object sender, EventArgs e)
    {
        //gia ve VN Rap Nam SG
        Response.Redirect("GiaVe.aspx");
    }
    protected void charlotte_Click(object sender, EventArgs e)
    {
        //
        Response.Redirect("CharLotte.aspx");
    }
    protected void lichvn_dm_Click(object sender, EventArgs e)
    {
        //Lich chieu VN Rap diamond
        Response.Redirect("lich_dm.aspx");
    }
    protected void giavn_dm_Click(object sender, EventArgs e)
    {
        //gia ve VN Rap Diamond
        Response.Redirect("GiaVe_dm.aspx");
    }
    protected void nsgMap_Click(object sender, EventArgs e)
    {
        //
    }
    protected void nsgMap_vn_Click(object sender, EventArgs e)
    {
        Response.Redirect("Map.aspx");
    }
}
